          <?php require_once('../Connections/agriculture.php'); ?>
                        <?php
                        if ($_SESSION["user"] != "") {
                            $user = $_SESSION["user"];
                        } else {
                            $user = $_POST["user"];
                        }
                        $pass = $_POST["pass"];
                        mysql_select_db($database_agriculture, $agriculture);
                        $query_Recordset1 = "SELECT * FROM users WHERE user_name = '" . $user . "'";
                        $Recordset1 = mysql_query($query_Recordset1, $agriculture) or die(mysql_error());
                        $row_Recordset1 = mysql_fetch_assoc($Recordset1);
                        $totalRows_Recordset1 = mysql_num_rows($Recordset1);

                        if ($_SESSION["user"] != "") {
                            doTable($row_Recordset1);
                        } elseif ($pass != "") {
                            if ($pass == $row_Recordset1["user_pass"]) {
                                $_SESSION["user"] = $user;
                                doTable($row_Recordset1);
                            } else {
                                echo '<script language="javascript">alert("账号或密码错误,请重新登陆!")</script>';
                                echo '<meta http-equiv="refresh" content="0;url=index.php">';
                                exit();
                            }
                        } else {
                            echo '<meta http-equiv="refresh" content="1;url=index.php">您无法查看该页,请登陆!';
                        }
                        ?>

                        <?php

                        function doTable($row_Recordset1) {
                            ;
                            ?>
                        <style type="text/css">
                            <!--
                            .STYLE1 {font-size: 14px}
                            -->
                        </style>
                        <span class="STYLE1">登陆成功,欢迎您,<?php echo $_SESSION["user"]; ?></span>
                        </p>
                        <p>&nbsp;</p>
                        <table width="800" height="304" border="1" cellpadding="0" cellspacing="0">
                            <tr>
                                <td colspan="2"><div align="center" class="STYLE1">账户信息</div></td>
                            </tr>
                            <tr>
                                <td rowspan="2"><p class="STYLE1">ID:<?php echo $row_Recordset1['user_id'] + 1; ?></p>
                                  <p class="STYLE1">账号:<?php echo $row_Recordset1['user_name']; ?></p>
                                  <p class="STYLE1">密码:****</p>
                                  <p class="STYLE1">邮箱:<?php echo $row_Recordset1['user_email']; ?></p>
                                  <p class="STYLE1">电话:<?php echo $row_Recordset1['user_tel']; ?></p>
                                <p class="STYLE1">注册时间:<?php echo $row_Recordset1['user_regtime']; ?></p></td>
                                <td width="366" height="40"><div align="center"><img src="<?php echo $row_Recordset1['user_photo']; ?>" alt="" width="128" height="128" /></div></td>
                            </tr>
                            <tr>
                                <td width="366">&nbsp;</td>
                            </tr>
                        </table>
                        <?php
                    }

                    ;
                    ?>

                    <?php
                    mysql_free_result($Recordset1);
                    ?>
